home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / varia / egebook.lha / ege.book / 1 / hello2.C < prev    next >
C/C++ Source or Header  |  1992-06-04  |  474b  |  26 lines

  1. #include <stdio.h>
  2.  
  3. struct HelloWorld {
  4.     char *message;
  5. };
  6.  
  7. void announce(struct HelloWorld& hw){
  8.     printf("%s \n", hw.message);
  9. }
  10.  
  11. void change(struct HelloWorld& hw, char *newmessage){
  12.     hw.message = newmessage;
  13. }
  14.  
  15. main(){
  16.     struct HelloWorld hw1, hw2;
  17.     change(hw1, "hello world");
  18.     change(hw2, "hello world");
  19.     announce(hw1);
  20.     announce(hw2);
  21.     change(hw1, "this is hw1");
  22.     change(hw2, "different object");
  23.     announce(hw1);
  24.     announce(hw2);
  25. }
  26.